import UserModel from "../models/user";
import {ObjectId} from "mongodb";

class User {

    async create(ctx) {
        await UserModel.create(ctx.request.body);
        ctx.body = ctx.request.body;
    }

    async update(ctx) {
        await UserModel.updateOne(
            {_id: new ObjectId(ctx.params.id)},
            ctx.request.body
        );
        ctx.body = ctx.request.body;
    }

}

export default new User();
